{extend name="public/base"/}
{block name="body"}
<div class="main-box no-header clearfix">
    <header class="main-box-header clearfix">
        <div class="pull-left">
            <h2>{$meta_title}（{$count}）</h2>
        </div>
        <div class="pull-right">
            <!-- <a href="{:url('add')}" class="btn btn-primary pull-right"> <i class="fa fa-plus-circle fa-lg"></i> 新增</a> -->
        </div>
    </header>
    <div class="main-box-body clearfix">
        {$Think.get.name}
        <div class="row">
            <form method="get">
                <div class="col-sm-12 col-md-4 col-lg-2">
                    <input type="text" class="form-control" name="wxname" value="{$Think.get.wxname}" placeholder="请输入微信名">
                </div>
                <div class="col-sm-12 col-md-4 col-lg-2">
                    <input type="text" class="form-control" name="start" value="{$Think.get.start}" placeholder="开始时间">
                </div>
                <div class="col-sm-12 col-md-4 col-lg-2">
                    <input type="text" class="form-control" name="end" value="{$Think.get.end}" placeholder="结束时间">
                </div>
                <div class="col-sm-12 col-md-4 col-lg-2" >
                    <select name="pay" id="category" class="form-control">
                        <option value="">全部</option>
                        {volist name=":config('pay')" id="vo"}
                        <option {eq name="$key" value="$Think.get.pay"}selected{/eq} value="{$key}">{$vo}</option>
                        {/volist}
                    </select>
                </div>
                <div class="col-sm-12 col-md-4 col-lg-2" >
                    <select name="buystatus"  class="form-control">
                        <option value="">全部</option>
                        <option {eq name="1" value="$Think.get.buystatus"}selected{/eq} value="1">待发货</option>
                        <option {eq name="3" value="$Think.get.buystatus"}selected{/eq} value="3">待签收</option>
                        <option {eq name="4" value="$Think.get.buystatus"}selected{/eq} value="4">已完成</option>
                    </select>
                </div>
                <br />
                <div class="col-sm-12 col-md-4 col-lg-12" style="    text-align: right;    margin-top: 10px;">
                  <button class="btn btn-primary" type="submit">搜索</button>
                </div>
            </form>
        </div>

        <div>
          销售额：{$count}
        </div>
        <div class="table-responsive">
            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th width="60">规格ID</th>
                    <th>商品名称</th>
                    <th>销售量</th>
                    <th>销售额</th>
                </tr>
                </thead>
                <tbody>
                {volist name="list" id="item"}
                <tr>
                    <td></td>
                    <td>{$item['good_name']}</td>
                    <td>
                      {$item['onum']}
                    </td>
                    <td>
                      {$item['priceSum']}
                    </td>

                </tr>
                {/volist}
                </tbody>
            </table>

        </div>
    </div>
</div>




<!-- datepicker statr -->
<link href="__PUBLIC__/plugs/datepicker/css/foundation-datepicker.min.css" rel="stylesheet" type="text/css">
<script src="__PUBLIC__/plugs/datepicker/js/foundation-datepicker.js"></script>
<script src="__PUBLIC__/plugs/datepicker/js/foundation-datepicker.zh-CN.js"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugs/board/board.min.css">
<!-- datepicker end -->
<script type="text/javascript">
    $('[name="start"]').fdatepicker({
        format: 'yyyy-mm-dd hh:ii',
        pickTime: true
    });
    $('[name="end"]').fdatepicker({
        format: 'yyyy-mm-dd hh:ii',
        pickTime: true
    });

    // implementation of disabled form fields
    // var nowTemp = new Date();
    // var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
    // var checkin = $('[name="start"]').fdatepicker({
    // 	format: 'yyyy-mm-dd',
    // }).on('changeDate', function (ev) {
    // 	if (ev.date.valueOf() > checkout.date.valueOf()) {
    // 		var newDate = new Date(ev.date)
    // 		newDate.setDate(newDate.getDate() + 1);
    // 		checkout.update(newDate);
    // 	}
    // 	checkin.hide();
    // 	$('[name="end"]')[0].focus();
    // }).data('datepicker');
    // var checkout = $('[name="end"]').fdatepicker({
    // 	format: 'yyyy-mm-dd',
    // 	onRender: function (date) {
    // 		return date.valueOf() <= checkin.date.valueOf() ? 'disabled' : '';
    // 	}
    // }).on('changeDate', function (ev) {
    // 	checkout.hide();
    // }).data('datepicker');

    var shopsau = "{$shopsau}"
    if(shopsau){
        $('[name="rebate_code"]').parent().remove();
        $('[name="pay"]').parent().remove();
        $('[name="index_type"]').parent().remove();
    }


    ispayUrl = ''
    $('.ispay').click(function(){
        $('#isPay').modal('show')
        ispayUrl = $(this).attr('url')
    })
    $('#isPay').on('shown.bs.modal', function () {
        var $this = $(this)

        $.get(ispayUrl, function(data){
            console.log(data);
            $this.find('.modal-body').html(data.msg+',微信支付订单号	：'+data.data.transaction_id+',支付金额：'+(data.data.cash_fee/100))
        })
    })


    $('#orderNo').on('show.bs.modal', function (e) {
        var id = $(e.relatedTarget.outerHTML).attr('data-id');
        $(e.target).find('[name="id"]').val(id);
    })


</script>


{/block}
